package com.zzxx.pojo;

import java.util.UUID;

//旅客
public class Traveller {
    private String id;
    private String name;
    private String sex;
    private String phoneNum;
    private Integer credentialsType; // 证件类型 0身份证 1护照 2军官证
    private String credentialsTypeStr;
    private String credentialsNum;
    private Integer travellerType; // 游客类型 0成人  1儿童
    private String travellerTypeStr;

    public String getId() {
        if (id==null){
            id = UUID.randomUUID().toString().replace("-","");
        }
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        if (name==null) name = "暂无数据";
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        if (sex==null){
            sex = "未知";
        }
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getPhoneNum() {
        if (phoneNum==null){
            phoneNum = "暂无数据";
        }
        return phoneNum;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    public Integer getCredentialsType() {
        if (credentialsType==null){
            if ("身份证".equals(credentialsTypeStr)){
                credentialsType = 0;
            }else if ("护照".equals(credentialsTypeStr)){
                credentialsType = 1;
            }else if ("军官证".equals(credentialsTypeStr)){
                credentialsType = 2;
            }else{
                credentialsType = -1;
            }
        }
        return credentialsType;
    }

    public void setCredentialsType(Integer credentialsType) {
        this.credentialsType = credentialsType;
    }

    public String getCredentialsTypeStr() {
        if (credentialsTypeStr==null){
            if (credentialsType==0){
                credentialsTypeStr = "身份证";
            }else if (credentialsType==1){
                credentialsTypeStr = "护照";
            }else if (credentialsType==2){
                credentialsTypeStr = "军官证";
            }else{
                credentialsTypeStr = "暂无数据";
            }
        }
        return credentialsTypeStr;
    }

    public void setCredentialsTypeStr(String credentialsTypeStr) {
        this.credentialsTypeStr = credentialsTypeStr;
    }

    public String getCredentialsNum() throws Exception {
        if (credentialsNum==null){
            credentialsNum = "暂无数据";
        }
        return credentialsNum;
    }

    public void setCredentialsNum(String credentialsNum) {
        this.credentialsNum = credentialsNum;
    }

    public Integer getTravellerType() {
        if (travellerType==null){
            if ("成人".equals(travellerTypeStr)){
                travellerType = 0;
            }else if ("儿童".equals(travellerTypeStr)){
                travellerType = 1;
            }else {
                travellerType = -1;
            }
        }
        return travellerType;
    }

    public void setTravellerType(Integer travellerType) {
        this.travellerType = travellerType;
    }

    public String getTravellerTypeStr() {
        if (travellerTypeStr==null){
            if (travellerType==0){
                travellerTypeStr = "成人";
            }else if (travellerType==1){
                travellerTypeStr = "儿童";
            }else{
                travellerTypeStr = "暂无数据";
            }
        }
        return travellerTypeStr;
    }

    public void setTravellerTypeStr(String travellerTypeStr) {
        this.travellerTypeStr = travellerTypeStr;
    }
}
